package com.rfid.afd.activity.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.rfid.rls_psw.R;

import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;

public class SyncAdapter extends RecyclerView.Adapter<SyncAdapter.MyHolder> {

    private Context mcContext;
    private List<String> mData;

    public SyncAdapter(Context context, List<String> data) {
        mcContext = context;
        mData = data;
    }

    @NonNull
    @Override
    public MyHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new MyHolder(LayoutInflater.from(mcContext).inflate(R.layout.item_sync_layout,parent,false));
    }

    @Override
    public void onBindViewHolder(@NonNull MyHolder holder, int position) {
        holder.textView.setText(mData.get(position));
    }

    @Override
    public int getItemCount() {
        return mData.size();
    }

    class MyHolder extends RecyclerView.ViewHolder {
        @BindView(R.id.text)
        TextView textView;
        public MyHolder(@NonNull View itemView) {
            super(itemView);
            ButterKnife.bind(this,itemView);
        }
    }
}
